<template>
    <div class="home-page">
        <section class="py-5 text-center container">
            <div class="row py-lg-5">
                <div class="col-lg-6 col-md-8 mx-auto">
                    <img src="../assets/patterns.e8579768.png" alt="" class="w-50"/>
                    <h2 class="font-weight-light">随心写作，自由表达</h2>
                    <a href="#" class="btn btn-primary my-2">开始写文章</a>
                    <h4 class="font-weight-bold text-center">发现精彩</h4>
                </div>
            </div>
        </section>
        
        <ColmunList :list="list"></ColmunList>
    </div>
</template>

<script lang="ts">
import { defineComponent, onMounted } from 'vue'
import { testData} from '@/testData'
import ColmunList from '@/components/ColmunList.vue'
import { computed } from '@vue/reactivity'
import { useStore } from 'vuex'
import { GolbalDataProps} from '../store'


export default defineComponent({
    components: {
        ColmunList
    },
    setup() {
        const store = useStore<GolbalDataProps>()
        const list = computed(() => store.state.columns)
        const biggerColumnLen = computed(() => store.getters.biggerColumnLen)
        //组件挂载的调用 请求
        onMounted(() => {
            store.dispatch('fetchColumns')
        })
        return {
            list: list,
            biggerColumnLen
        }
    }
})
</script>

<style>

</style>